package com.zhong.thesimpleconnection.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.hyphenate.easeui.ui.EaseBaseFragment;
import com.zhong.thesimpleconnection.util.BaseFragment;

import java.util.List;

/**
 * Created by 俊峰 on 2017/5/18.
 */

public class CommenFragmentPagerAdapter extends FragmentStatePagerAdapter{

    private List<EaseBaseFragment> mFragmentList;

    public CommenFragmentPagerAdapter(FragmentManager fm, List<EaseBaseFragment> fragments){
        super(fm);
        this.mFragmentList = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragmentList.get(position);
    }

    @Override
    public int getCount() {
        int ret = 0;
        if (mFragmentList != null) {
            ret = mFragmentList.size();
        }
        return ret;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mFragmentList.get(position).getFragmentTitle();
    }
}
